<template>
  <div>
    <TypeNav></TypeNav>
    <ListContainer></ListContainer>
    <TodayRecomment></TodayRecomment>
    <Rank></Rank>
    <Like></Like>
    <Floor v-for="(floor,index) in floorList" :key="floor.id" :floor="floor"></Floor>
    <Brand></Brand>
<!--    <button @click="add">点击+1</button>-->
<!--      <span>count:{{count}}</span>-->
<!--    <button @click="sub">点击-1</button>-->
  </div>
</template>

<script>
import ListContainer from './ListContainer/index'
import TodayRecomment from './TodayRecommend/index'
import Rank from './Rank/index'
import Like from './Like/index'
import Floor from './Floor/index'
import Brand from './Brand/index'

import {mapState} from "vuex";
export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "Home",
  components:{
    ListContainer,
    TodayRecomment,
    Rank,
    Like,
    Floor,
    Brand,
  },
  mounted() {
    //组件一挂载就发起访问请求，获取floorList
    this.$store.dispatch('floorList')
    //根据用户token，获取用户信息
    try {
      this.$store.dispatch('getUserInfoByToken')
    }catch (error){
      alert(error.message)
    }
  },
  computed:{
    ...mapState({floorList:(state)=>{
        return state.home.floorList
      }})
  }
}
</script>

<style scoped>

</style>